<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use Watson\Validating\ValidatingTrait;

class Student extends Model
{
    use  Notifiable;
//    use ValidatingTrait;
    use SoftDeletes;
    protected $table = 'students';
    //
    protected $fillable = [
        'id', 'u_name', 'u_code','wx_key','school','major','access_token','nick_name','head','teach_class','business_class'
    ];
    public function teach(){
        return $this->hasOne('App\Models\org\OrganizationalStructure','jcbid','teach_class');
    }
    public function business(){
        return $this->hasOne('App\Models\org\OrganizationalStructure','jcbid','business_class');
    }
//    protected $rules = [
//        'u_name' => 'required|max:20',
//        'u_code' => 'unique:students',
//    ];
//
//
//    protected $validationMessages = [
//        'u_name.required' => '学生名称必填',
//        'u_name.max' => '学生名称名长度不得超过20个字符',
//        'u_code.unique' => '该学生编码已经被注册过了'
//    ];
}
